//
//  LVSSessionSearchView.m
//  LEVE
//
//  Created by 上官惠阳 on 2017/1/12.
//  Copyright © 2017年 dashuju. All rights reserved.
//

#import "LVSSessionSearchView.h"
#import "UIView+Frame.h"

@implementation LVSSessionSearchView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = kRGBColor(255,255,255);

        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [btn setImage:[UIImage imageNamed:@"send_search"] forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:15];
        btn.left = 13;
        btn.width = frame.size.width - 20;
        btn.height = frame.size.height - 20;
        btn.centerY = self.centerY;
        btn.backgroundColor = kRGBColor(240,241,244);
        btn.layer.cornerRadius = btn.height / 2;
        btn.layer.masksToBounds = YES;
        [btn addTarget:self action:@selector(searchAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:btn];
    }
    return self;
}
- (void)searchAction:(UIButton *)btn
{
    if (_searchBlock) {
        _searchBlock(nil);
    }
}

@end
